﻿CREATE VIEW [dbo].[TopUsers]
	AS 
	   SELECT TOP 100 percent
	A.AppName,
	[Username],
    COUNT(*) AS [Count]
  FROM [dbo].[AppAnalytics] AA INNER JOIN [dbo].[App] A ON AA.[AppId] = A.[AppId]
  WHERE
	[HostWebUrl] NOT LIKE 'https://arthurgraus.sharepoint.com%'
  GROUP BY
	A.AppName,
	[Username]
  ORDER BY
	A.AppName,
	COUNT(*) DESC
